<template>
  <div id="app">
    <!-- 顶部 -->
    <div class="stick">
      <div class="wrapper">
        <!-- 入口区域右侧 -->
        <ul>
          <li><a href="http://oa.gxust.edu.cn/">(1)OA办公系统入口</a></li>
          <li><a href="http://mail.gxust.edu.cn/">(2)教工学校邮箱</a></li>
          <li>
            <a href="http://mail.stdmail.gxust.edu.cn/">(3)学生学校邮箱入口</a>
          </li>
        </ul>
      </div>
    </div>

    <!-- 头部 -->
    <div class="header">
      <div class="wrapper">
        <!-- logo -->
        <a href="./"><div class="logo"></div></a>
        <!-- 搜索框 -->
        <form action="#" method="get">
          <div class="search">
            <input type="submit" name="submit" value="" class="icon" />
            <input type="search" name="search" class="searchInput" />
          </div>
        </form>
      </div>

      <!-- 导航栏 -->
    </div>

    <m-nav v-bind:navTitle="navTitle" class="nav"></m-nav>

    <!-- 主区域 -->
    <router-view class="main">
      <router-view></router-view>
    </router-view>

    <!-- 底部 -->
    <div class="footer">
      <div class="top">
        <div class="wrapper">
          <div class="left">
            <h2 class="topText">广西科技大学智慧校园</h2>
            <div class="qrcode">
              <!-- qrcode -->
            </div>
            <div class="bottomText">微信“扫一扫关注”</div>
          </div>
          <div class="right">
            <div class="rightTop">联系我们</div>
            <ul class="rightList">
              <li>地址：广西柳州市东环大道268号广西科技大学</li>
              <li>邮政编码：545006</li>
              <li>联系电话：(0772)2686311</li>
            </ul>
          </div>
        </div>
      </div>
      <div class="bottom">
        <div class="wrapper">
          <p>
            广西科技大学 网络与现代教育技术中心 版权所有
            地址：广西柳州市城中区东环大道268号
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { get } from "./utils/request.js";
import mnav from "./components/Nav.vue";

export default {
  components: {
    mNav: mnav,
  },
  data() {
    return {
      // 导航栏
      navTitle: [],
    };
  },
  methods: {
    // 请求导航栏搜索栏目树
    async findCategoryTree() {
      let data = await get("/index/category/findCategoryTree");

      let navTitle = [];
      data.data.forEach((item) => {
        let { id, name, children } = item;

        let temp = {
          id,
          title: name,
          childs: [],
          show: false,
        };

        children.forEach((item) => {
          temp.childs.push({
            id: item.id,
            title: item.name,
            parentId: item.parentId,
          });
        });

        navTitle.push(temp);
      });
      this.navTitle = navTitle;
    },

  },
  created() {
    this.findCategoryTree();
  },
};
</script>
<style lang="scss" scoped>
@import "@/style/main.scss";
// 顶部
.stick {
  background-color: $--theme-primary;
  line-height: 30px;
  height: 30px;
  ul {
    float: right;
    li {
      float: left;
      padding: 0 3px;
      a {
        font-size: 15px;
        color: #e6e5e5;
      }
    }
  }
}
// 头部
.header {
  height: 100px;
  padding-top: 20px;
  box-sizing: border-box;
  .logo {
    width: 707px;
    height: 65px;
    background: url(./assets/wl.png);
    float: left;
  }

  .icon {
    background: url(./assets/search.png);
    background-position: 50% 50%;
    background-repeat: no-repeat;
    border: none;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: block;
    float: left;
    margin: 8px 8px 0 16px;
  }

  .search {
    width: 275px;
    height: 35px;
    border: 1px solid #eeeeee;
    box-shadow: inset 0 1px 2px #eeeeee;
    border-radius: 25px;
    float: right;
    margin-top: 30px;
    position: relative;

    .searchInput {
      width: 220px;
      height: 31px;
      font-size: 14px;
      color: #a2a2a2;
      outline: none;
      line-height: 31px;
      margin-top: 3px;
      float: left;
      border-radius: 25px;
      border: none;
      background-size: contain;
    }
  }
}
input::-webkit-search-cancel-button {
  display: none;
}

// 轮播图
.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 150px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}

.nav {
  position: relative;
  z-index: 99;
}
.main {
  min-height: 414px;
}
.footer {
  .top {
    color: #fff;
    background: $--theme-primary;
    margin-top: 40px;
    overflow: hidden;
    .left {
      float: left;
      display: flex;
      flex-direction: column;
      .topText {
        font-size: 24px;
        padding-top: 20px;
        font-weight: bold;
        margin-bottom: 20px;
      }
      .qrcode {
        overflow: hidden;
        width: 81px;
        height: 81px;
        background: url(./assets/qrcode.png);
        background-size: cover;
        margin: 12px 0 12px 50px;
      }
      .bottomText {
        font-size: 14px;
        margin: 12px 0 12px 20px;
      }
    }

    .right {
      float: right;
      .rightTop {
        font-size: 24px;
        padding-top: 20px;
        font-weight: bold;
        margin-bottom: 20px;
      }
      .rightList {
        margin-top: 32px;
        li {
          margin: 12px 0;
        }
      }
    }
  }
  .bottom {
    background: #282a2e;
    p {
      line-height: 40px;
      color: #ababac;
      font-size: 14px;
    }
  }
}
</style>
